//
//  XJEmojiModel.swift
//  新浪微博
//
//  Created by 徐绩 on 16/4/27.
//  Copyright © 2016年 ayumi. All rights reserved.
//

import UIKit

class XJEmojiModel: NSObject ,NSCoding{
    
    //表情描述字符串
    var chs: String?
    
    //类型:1 Emoji表情 2 图片表情
    var type: String?
    
    //Emoji
    var code: String?
    
    //当前表情对应文件夹
    var fileName: String?
    
    //表情对应图片
    var png: String?
    
    init(dict: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    //解档
    required init?(coder aDecoder: NSCoder) {
        
        chs = aDecoder.decodeObjectForKey("chs") as? String
        type = aDecoder.decodeObjectForKey("type") as? String
        code = aDecoder.decodeObjectForKey("code") as? String
        fileName = aDecoder.decodeObjectForKey("fileName") as? String
        png = aDecoder.decodeObjectForKey("png") as? String
        
    }
    //归档
    func encodeWithCoder(aCoder: NSCoder) {
     
        aCoder.encodeObject(chs, forKey: "chs")
        aCoder.encodeObject(type, forKey: "type")
        aCoder.encodeObject(code, forKey: "code")
        aCoder.encodeObject(fileName, forKey: "fileName")
        aCoder.encodeObject(png, forKey: "png")
        
    }
    
    override var description: String {
        let keys = ["chs", "code", "type"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
